<template>
	<view class="container">
		<image src="../static/img/ps-yb@2x.png" style="width: 750rpx;height: 524rpx;position: fixed;top: 0;"></image>
		<nv :config="config"></nv>
		<view class="flex f-column main-box">
			<view class="white-box flex f-column f-align f-justifyB">
				<view class="flex f-align w100" v-if="type == 'ps'">
					<view class="f-center flex1 f-column order-box" @click="scanCode(1)">
						<text class="font40 gray333">接收脏衣</text>
						<text class="font24 gray777 mt10">扫描订单条码</text>
						<text class="font24 gray777 mb20">接收脏衣</text>
						<image src="../static/img/shouyesaomiao@2x.png"></image>
					</view>
					<view class="line"></view>
					<view class="f-center flex1 f-column order-box" @click="scanCode(2)">
						<text class="font40 gray333">接收净衣</text>
						<text class="font24 gray777 mt10">扫描订单条码</text>
						<text class="font24 gray777 mb20">接收净衣</text>
						<image src="../static/img/shouyesaomiao@2x.png"></image>
					</view>
				</view>
				<view class="flex f-align w100" v-if="type == 'gc'">
					<view class="f-center flex1 f-column order-box" @click="scanCode(1)">
						<text class="font40 gray333">开始清洗</text>
						<text class="font24 gray777 mt10">扫描订单条码</text>
						<text class="font24 gray777 mb20">开始清洗</text>
						<image src="../static/img/shouyesaomiao@2x.png"></image>
					</view>
					<view class="line"></view>
					<view class="f-center flex1 f-column order-box" @click="scanCode(2)">
						<text class="font40 gray333">清洗完成</text>
						<text class="font24 gray777 mt10">扫描订单条码</text>
						<text class="font24 gray777 mb20">清洗完成</text>
						<image src="../static/img/shouyesaomiao@2x.png"></image>
					</view>
				</view>
				<view class="flex f-align w100" v-if="type == 'xy'">
					<view class="f-center flex1 f-column order-box" @click="scanCode(1)">
						<text class="font40 gray333">接收净衣</text>
						<text class="font24 gray777 mt10">扫描订单条码</text>
						<text class="font24 gray777 mb20">接收净衣</text>
						<image src="../static/img/shouyesaomiao@2x.png"></image>
					</view>
					<view class="line"></view>
					<view class="f-center flex1 f-column order-box" @click="$api.toPage('./roleOrderList')">
						<text class="font40 gray333">订单列表</text>
						<text class="font24 gray777 mt10">扫描订单条码</text>
						<text class="font24 gray777 mb20">接收净衣</text>
						<image src="../static/img/ps-dingdan@2x.png" style="width: 80rpx;"></image>
					</view>
				</view>
				<view class="flex f-align f-justifyB help-box" v-if="type != 'ps'" @click="$api.toPage('./roleOrderList')">
					<view class="flex f-align">
						<image src="../static/img/ps-dingdan@2x.png" style="width: 64rpx;height: 80rpx;margin-right: 30rpx;"></image>
						<text class="font40">订单列表</text>
					</view>
					<image src="../static/img/syzizhuyou@2x.png" style="width: 24rpx;height: 48rpx;"></image>
				</view>
				<view class="flex f-align f-justifyB help-box" v-else @click="$api.toPage('./schoolQu')">
					<view class="flex f-align">
						<image src="../static/img/shouyuzizhuqujian@2x.png" style="width: 64rpx;height: 80rpx;margin-right: 30rpx;"></image>
						<text class="font40">待取订单</text>
					</view>
					<image src="../static/img/syzizhuyou@2x.png" style="width: 24rpx;height: 48rpx;"></image>
				</view>
        <!-- 工厂入口不显示 -->
				<view v-if="type != 'gc'" class="flex f-align f-justifyB helpyuyue-box" @click="$api.toPage('../delivery_pages/deliveryOrderList/deliveryOrderList')">
					<view class="flex f-align">
						<image src="../static/img/预约图标.png" style="width: 64rpx;height: 70rpx;margin-right: 30rpx;"></image>
						<text class="font40">待取预约订单</text>
					</view>
					<image src="../static/img/syzizhuyou@2x.png" style="width: 24rpx;height: 48rpx;"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import nv from "@/components/pyh-nv/pyh-nv.vue";
	export default {
		data() {
			return {
				config: {
					title: uni.getStorageSync('pageTitle'),
					bgColor: 'rgba(0,0,0,0)',
					color: '#ffffff',
					hideback: false
				},
				title: '',
				type: ''
			}
		},
		components: {
			nv
		},
		onLoad() {
			this.title = uni.getStorageSync('pageTitle')
			if (this.title == '校园入口') {
				this.type = 'xy'
			} else if (this.title == '配送入口') {
				this.type = 'ps'
			} else {
				this.type = 'gc'
			}
		},
		onHide() {
			// if (this.title == '工厂入口') {
			// 	let plugin = requirePlugin("myPlugin")
			// 	plugin.closeBLEConnection() // 关闭连接
			// }
		},
		methods: {
			onceRent() {
				if (!this.hasLogin) {
					this.$api.toPage('./auth/login')
					return
				}
				if (this.orderId) {
					uni.showModal({
						title: '提示',
						content: '你有一笔租用订单正在进行中！',
						cancelText: '取消',
						confirmText: '查看订单',
						success: res => {
							if (res.confirm) {
								this.$api.toPage('./useDetail?orderId=' + this.orderId)
							}
						}
					});
				} else {
					this.$api.toPage('./goodsList?gzbh=' + getApp().globalData.gzbh)
				}
			},
			scanCode(type) {
				uni.scanCode({
					onlyFromCamera: true,
					success: (res) => {
						if (res.result) {
							uni.navigateTo({
								url: './roleOrderDetail?code=' + res.result + '&type=' + type
							})
						}
					}
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.container {
		padding: 0;

		.main-box {
			position: fixed;
			top: 410rpx;
			left: 32rpx;
			z-index: 99;

			.white-box {
				width: 686rpx;
				background: rgba(255, 255, 255, 1);
				box-shadow: 0rpx 6rpx 20rpx rgba(24, 70, 157, 0.18);
				border-radius: 12rpx;
				padding: 32rpx;

				.line {
					width: 1rpx;
					height: 200rpx;
					background-color: #A6A6A6;
				}

				.order-box {
					height: 300rpx;

					image {
						width: 100rpx;
						height: 100rpx;
					}
				}
			}

			.help-box {
				padding: 36rpx 50rpx 20rpx;
				width: 100%;
				border-top: 1px solid #A6A6A6;
				margin-top: 20rpx;
			}
			.helpyuyue-box {
				padding: 36rpx 50rpx 20rpx;
				border-top: 1px solid #A6A6A6;
				width: 100%;
				margin-top: 20rpx;
			}
		}

		::v-deep .nvBox {
			background: rgba(0, 0, 0, 0) !important;
		}
	}
</style>
